<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title></title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="__ADMIN__/css/font.css">
<link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
<script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/layui/layui.js?t=1.1" charset="utf-8"></script>
<script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
<script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
<link rel="stylesheet" href="/static/admin/css/font.css">
<link rel="stylesheet" href="/static/admin/css/font-awesome.min.css">
<style>
.layui-form-item .layui-form-label{
    width: 120px;
}
.layui-form-item .layui-textarea{
    width: 190px;
}
#phone-one-div {display: none}
.required{background:#F6CECE !important}
.unrequired{background:#eee}
#page-2{display:none}
.client_fee_1, .client_fee_2, .client_fee_3, .client_fee_4, .client_fee_5, .fee_1, .fee_2, .fee_3, .fee_4, .fee_5{display:none}
body{background:url(/static/admin/images/dontscreenshot.png) #fff}
</style>
</head>
  
  <body>
    <div class="x-body">
        <form class="layui-form layui-form-pane">
            <div style="font-size:16px;">恭喜你，{$data.admin_name?:session('uname','','admin')}又有业绩了</div>
            <input type="hidden" id="id" name="id">
            <div id="page-1">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>活动信息</legend>
            </fieldset>
            <div class="layui-form-item">
                <input type="hidden" value="{$data.admin_name?:session('uname','','admin')}" id="admin_name" name="admin_name" lay-verify="required" readonly autocomplete="off" class="layui-input">
                <!--<label for="activity" class="layui-form-label">-->
                <!--    业务员-->
                <!--</label>-->
                <!--<div class="layui-input-inline">-->
                <!--    <input type="hidden" value="{$data.admin_name?:session('uname','','admin')}" id="admin_name" name="admin_name" lay-verify="required" readonly autocomplete="off" class="layui-input">-->
                <!--</div>-->
                <!--<label for="client_id" class="layui-form-label">-->
                <!--    选择活动-->
                <!--</label>-->
                <!--<div class="layui-input-inline">-->
                <!--    <select name="client_id"  id="client_id" lay-verify="required" lay-search="">-->
                <!--        <option value="">选择你签单的活动</option>-->
                <!--        {volist name="clientList" id="value"}-->
                <!--        <option value="{$value.id}">{$value.id}-{$value.activity}</option>-->
                <!--        {/volist}-->
                <!--    </select>-->
                <!--</div>-->
                <label for="live_id" class="layui-form-label required">
                    直播平台ID
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="请先填入海豚直播ID"  name="live_id" id="live_id" lay-verify="required" autocomplete="off" class="layui-input">
                </div>

            </div>
            <div class="layui-form-item" id="area-picker">
                <!--<div class="layui-form-label">活动地区</div>-->
                <!--<div class="layui-input-inline" style="width: 200px;">-->
                <!--    <select name="province" class="province-selector" lay-search data-value="{$data.province}" lay-filter="province-1">-->
                <!--        <option value="">请选择省</option>-->
                <!--    </select>-->
                <!--</div>-->
                <!--<div class="layui-input-inline" style="width: 200px;">-->
                <!--    <select name="city" class="city-selector" lay-search data-value="{$data.city}" lay-filter="city-1">-->
                <!--        <option value="">请选择市</option>-->
                <!--    </select>-->
                <!--</div>-->
                <!--<div class="layui-input-inline" style="width: 200px; display:none">-->
                <!--    <select name="county" class="county-selector" data-value="" lay-filter="county-1">-->
                <!--        <option value="">请选择区</option>-->
                <!--    </select>-->
                <!--</div>-->
                <label for="title" class="layui-form-label">
                    活动名称
                </label>
                <div class="layui-input-inline" style="width:300px">
                    <input type="text" value="" placeholder="活动名称" name="title" id="title" lay-verify="required" autocomplete="off" class="layui-input unrequired">
                </div>
                <label for="" class="layui-form-label">
                    投票时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" value="" readonly placeholder="开始时间" name="start_date" id="start_date" lay-verify="required" autocomplete="off" class="layui-input" style="background:#eee">
                </div>
                <div class="layui-input-inline">
                    <input type="text" value="" readonly placeholder="结束时间" name="end_date" id="end_date" lay-verify="required" autocomplete="off" class="layui-input" style="background:#eee">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="client_ratio" class="layui-form-label required">
                    客户比例(%)
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="单位：%" name="client_ratio" id="client_ratio" lay-verify="required" autocomplete="off" class="layui-input " >
                </div>
                <label for="salesman_radio" class="layui-form-label">
                    业务员比例(%)
                </label>
                <div class="layui-input-inline">
                    <input type="text" value="" placeholder="单位：%" readonly name="salesman_radio" id="salesman_radio" lay-verify="required" autocomplete="off" class="layui-input" style="background:#eee">
                </div>
            </div>
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>活动收益</legend>
            </fieldset>
            <div class="layui-form-item">
                <!--<label for="total_income" class="layui-form-label" >-->
                <!--    后台收益-->
                <!--</label>-->
                <!--<div class="layui-input-inline">-->
                <!--    <input type="text" value="" placeholder="单位：元" name="total_income" id="total_income" lay-verify="required" readonly autocomplete="off" class="layui-input">-->
                <!--</div>-->

                <label for="reduce_income" class="layui-form-label ri_div_label" style="font-size:18px;width:1px;">
                    *　*　*
                </label>
                <div class="layui-input-inline ri_div" style="display:none">
                    <input type="number" value="" placeholder="0" name="reduce_income" id="reduce_income" autocomplete="off" class="layui-input">
                </div>
                <label for="refund_income" class="layui-form-label">
                    投错票金额
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="refund_income" id="refund_income" autocomplete="off" class="layui-input">
                </div>

                <div class="layui-input-inline">
                    <div class="layui-btn-group">
                    <button type="button" id="fee_btn3" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe624;</i></button>
                    <button type="button" id="fee_btn4" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe67e;</i></button>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <!--<label for="other_income_text" class="layui-form-label" style="width:152px">-->
                <!--    共同承担成本内容备注-->
                <!--</label>-->
                <!--<div class="layui-input-inline" style="width:300px">-->
                <!--    <input type="text" value="" placeholder="共同承担成本内容备注" name="other_income_text" id="other_income_text" lay-verify="required" autocomplete="off" class="layui-input">-->
                <!--</div>-->
                <div class="fee_1">
                    <label for="live_fee" class="layui-form-label">
                        直播费
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="live_fee" id="live_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="fee_2">
                    <label for="plive_fee" class="layui-form-label">
                        照片直播
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="plive_fee" id="plive_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="fee_3">
                    <label for="gift_fee" class="layui-form-label">
                        礼品费
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="gift_fee" id="gift_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="fee_4">
                    <label for="travel_fee" class="layui-form-label">
                        差旅费
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="travel_fee" id="travel_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="fee_5">
                    <label for="other_fee" class="layui-form-label">
                        其它费用
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="other_fee" id="other_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="real_income" class="layui-form-label" style="background: #fffb76;">
                    实际收益
                </label>
                <div class="layui-input-inline">
                    <input type="text" value="" placeholder="单位：元" name="real_income" id="real_income" lay-verify="required" autocomplete="off" class="layui-input" readonly>
                </div>
            </div>
            
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>客户收益</legend>
            </fieldset>
            <div class="layui-form-item">
                <label for="client_income" class="layui-form-label">
                    客户收益
                </label>
                <div class="layui-input-inline">
                  <input type="text" value="" readonly placeholder="单位：元" name="client_income" id="client_income" autocomplete="off" class="layui-input">
                </div>
                <label for="client_sxfee_radio" class="layui-form-label">
                    手续费点位
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="0" placeholder="单位：%" name="client_sxfee_radio" id="client_sxfee_radio" autocomplete="off" class="layui-input">
                </div>
                <label for="client_charges" class="layui-form-label">
                    手续费
                </label>
                <div class="layui-input-inline">
                    <input type="text" value="" placeholder="单位：元" name="client_charges" id="client_charges" readonly autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline">
                    <div class="layui-btn-group">
                    <button type="button" id="fee_btn1" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe624;</i></button>
                    <button type="button" id="fee_btn2" class="layui-btn layui-btn-primary layui-btn-sm"><i class="layui-icon">&#xe67e;</i></button>
                    </div>
                </div>
                
                <div class="layui-input-inline">
                    
                </div>
            </div>
            <div class="layui-form-item">
                <div class="client_fee_1">
                    <label for="client_live_fee" class="layui-form-label">
                        直播费
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="client_live_fee" id="client_live_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="client_fee_2">
                    <label for="client_plive_fee" class="layui-form-label">
                        照片直播
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="client_plive_fee" id="client_plive_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="client_fee_3">
                    <label for="client_gift_fee" class="layui-form-label">
                        礼品费
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="client_gift_fee" id="client_gift_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="client_fee_4">
                    <label for="client_travel_fee" class="layui-form-label">
                        差旅费
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="client_travel_fee" id="client_travel_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="client_fee_5">
                    <label for="client_other_fee" class="layui-form-label">
                        其它费用
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" value="" placeholder="0" name="client_other_fee" id="client_other_fee" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="client_final_income" class="layui-form-label" style="background: #fffb76;">
                    实际收益
                </label>
                <div class="layui-input-inline">
                    <input type="number" readonly value="" placeholder="单位：元" name="client_final_income" id="client_final_income" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="button" class="layui-btn layui-btn-primary next-btn">下一步</button>
                </div>
            </div>
            </div>
            <div id="page-2">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>业务员收益</legend>
            </fieldset>
            <div class="layui-form-item">
                <label for="salesman_performance" class="layui-form-label" >
                    赛事业绩
                </label>
                <div class="layui-input-inline">
                    <input type="text" value="" readonly placeholder="单位：元" name="salesman_performance" id="salesman_performance" autocomplete="off" class="layui-input">
                </div>
                <label for="salesman_charges" class="layui-form-label">
                    手续费
                </label>
                <div class="layui-input-inline">
                    <input type="text" value="" readonly placeholder="单位：元" name="salesman_charges" id="salesman_charges" autocomplete="off" class="layui-input">
                </div>
                <label for="salesman_recommend_fee" class="layui-form-label">
                    介绍费
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="salesman_recommend_fee" id="salesman_recommend_fee" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="salesman_live_fee" class="layui-form-label">
                    直播费
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="salesman_live_fee" id="salesman_live_fee" autocomplete="off" class="layui-input">
                </div>
                <label for="salesman_plive_fee" class="layui-form-label">
                    照片直播
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="salesman_plive_fee" id="salesman_plive_fee" autocomplete="off" class="layui-input">
                </div>
                <label for="salesman_gift_fee" class="layui-form-label">
                    礼品费
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="salesman_gift_fee" id="salesman_gift_fee" autocomplete="off" class="layui-input">
                </div>
                <label for="salesman_travel_fee" class="layui-form-label">
                    差旅费
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="salesman_travel_fee" id="salesman_travel_fee" autocomplete="off" class="layui-input">
                </div>
                <label for="salesman_other_fee" class="layui-form-label">
                    其它费用
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="salesman_other_fee" id="salesman_other_fee" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="salesman_other_performance" class="layui-form-label">
                    其它业绩
                </label>
                <div class="layui-input-inline">
                    <input type="number" value="" placeholder="0" name="salesman_other_performance" id="salesman_other_performance" autocomplete="off" class="layui-input">
                </div>
                <label for="salesman_final_performance" class="layui-form-label" style="background: #fffb76;">
                    业绩总和
                </label>
                <div class="layui-input-inline">
                    <input type="text" readonly value="" placeholder="单位：元" name="salesman_final_performance" id="salesman_final_performance" autocomplete="off" class="layui-input">
                </div>
            </div>
            
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="button" class="layui-btn layui-btn-primary prev-btn">上一步</button>
                    
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="add">申报</button>
                    <button type="submit" class="layui-btn" lay-submit="" lay-filter="save">暂存</button>
                </div>
            </div>
            </div>
        </form>
    </div>

    <script>
        layui.use(['form','layer','laydate','dropdown','layarea'], function(){
          $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer
          ,laydate = layui.laydate
          ,dropdown = layui.dropdown
          ,layarea = layui.layarea;
            // laydate.render({
            //     elem: '#start_date'
            // });
            // laydate.render({
            //     elem: '#end_date'
            // });
            layarea.render({
                elem: '#area-picker',
                change: function (res) {
                    console.log(res);
                }
            });
        dropdown.render({
            elem: '#fee_btn1'
            ,trigger: 'hover'
            ,data: [{
              title: '直播费'
              ,id: 1
            },{
              title: '照片直播'
              ,id: 2
            },{
              title: '礼品费'
              ,id: 3
            },{
              title: '差旅费'
              ,id: 4
            },{
              title: '其它费用'
              ,id: 5
            }],click: function(obj){
                $('.client_fee_'+obj.id).show();
            }
        });
        dropdown.render({
            elem: '#fee_btn2'
            ,trigger: 'hover'
            ,data: [{
              title: '直播费'
              ,id: 1
            },{
              title: '照片直播'
              ,id: 2
            },{
              title: '礼品费'
              ,id: 3
            },{
              title: '差旅费'
              ,id: 4
            },{
              title: '其它费用'
              ,id: 5
            }],click: function(obj){
                $('.client_fee_'+obj.id+' input').val(0);
                $('.client_fee_'+obj.id).hide();
                updateData();
            }
        });
        dropdown.render({
            elem: '#fee_btn3'
            ,trigger: 'hover'
            ,data: [{
              title: '直播费'
              ,id: 1
            },{
              title: '照片直播'
              ,id: 2
            },{
              title: '礼品费'
              ,id: 3
            },{
              title: '差旅费'
              ,id: 4
            },{
              title: '其它费用'
              ,id: 5
            }],click: function(obj){
                $('.fee_'+obj.id).show();
            }
        });
        dropdown.render({
            elem: '#fee_btn4'
            ,trigger: 'hover'
            ,data: [{
              title: '直播费'
              ,id: 1
            },{
              title: '照片直播'
              ,id: 2
            },{
              title: '礼品费'
              ,id: 3
            },{
              title: '差旅费'
              ,id: 4
            },{
              title: '其它费用'
              ,id: 5
            }],click: function(obj){
                $('.fee_'+obj.id+' input').val(0);
                $('.fee_'+obj.id).hide();
                updateData();
            }
        });
        
        
        
        {if condition="$data"}
        {foreach name="data" id="value" key="key"}
        $('#{$key}').val('{$value}');
        {/foreach}
        {/if}
        
        var rishow = 0;
        $('.ri_div').click(function(){
            if(rishow == 0){
                $('.ri_div').show(300);
                $('.ri_div_label').width(120);
                $('#reduce_income').focus();
                rishow = 1;
            }else{
                $('.ri_div').hide(0);
                $('.ri_div_label').width(0);
                rishow = 0;
            }
        })
        $('#reduce_income').blur(function(){
            $('.ri_div').hide(300);
            $('.ri_div_label').width(0);
            rishow = 0;
        })
        form.on('submit(add)', function(data){
            if(!data.field.client_final_income || !data.field.salesman_final_performance|| data.field.client_sxfee_radio!='')
            {
                layer.alert('数据不完整，无法上报');
                return false;
            }
            $.ajax({
                type:'POST',
                dataType:'json',
                data:{data:data.field,status:1},
                success:function(obj){
                    layer.alert(obj.msg, {icon: obj.icon},function(){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        x_admin_father_reload();
                    });    
                }
            });
            return false;
        });
          
        form.on('submit(save)', function(data){
            $.ajax({
                type:'POST',
                dataType:'json',
                data:{data:data.field,status:0},
                success:function(obj){
                    layer.alert(obj.msg, {icon: obj.icon},function(){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        x_admin_father_reload();
                    });    
                }
            });
            return false;
        });

        var page = 1;
        $('.next-btn').click(function(){
            $('#page-'+page).hide();
            page++;
            $('#page-'+page).show();
        })
        $('.prev-btn').click(function(){
            $('#page-'+page).hide();
            page--;
            $('#page-'+page).show();
        })

        $('#client_ratio').blur(function(){
            $('#salesman_radio').val(100-$(this).val());
        })
        
        $('#live_id').blur(function(){

        })
        
        $('input').blur(function(){
            if($(this).attr('id') == 'live_id'){
                $.get('getTotalIncome?live_id='+$(this).val(),function(data){
                    if(data.code == 1)
                    {
                        $.each(data.data, function(index, value) {
                            if(value!='') {
                                $('#'+index).val(value);
                            }
                        });
                    }
                },'json')
            }else{
                updateData();
            }

        })
          
        function updateData()
        {
            $.post('compute?type=1',$('form').serializeArray(),function(data){
                data = JSON.parse(data);
                if(data.code == 1)
                {
                    $.each(data.data, function(index, value) {
                        if( index != 'salesman_radio') {
                            $('#'+index).val(value);
                        }
                    });
                    //value != '' &&
                }
            },'json')
        }
        
    });
    </script>
  </body>

</html>